// components/courseCard/courseCard.ts
import {getTeacherCourseDetail} from '../../../api/teacher/course'
Component({

  /**
   * 组件的属性列表
   */
  properties: {
  
  },

  /**
   * 组件的初始数据
   */
  data: {
    info:{}, //课程信息
    title:"",
    lessonId:""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onLoad(data:any){
   const lessonId = data.lessonId
   this.setData({
    lessonId
   })
   this.setData({
     title:data.title
   })
   this.getCourseDetail(lessonId)
    },
    async getCourseDetail(lessonId:string){
    const {code,data:res,msg} = await getTeacherCourseDetail({
      lessonId:Number(lessonId)
    })
    if(code === 200){
    this.setData({
      info:res
    })
    }else{
      Promise.reject(msg)
    }
    console.log("从i是的教师客车g",res);
    
    },
    // 查看学生详情
    seeStudentInfo(){
      
     wx.navigateTo({
       url:`/curriculum_package/pages/courseStuDetail/courseStuDetail?lessonId=${this.data.lessonId}`
     })
    }
  }
})